<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台管理</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 顶部菜单开始 -->
    <div class="layui-header">
        <div class="layui-logo"><i class="layui-icon">&#xe653;</i>外卖订餐管理系统</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img class="layui-nav-img" src="img/admin_avatar.jpg">
                    <span id="nickName"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a id="logOutBtn" href="javascript:;">退出系统</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <!-- 顶部菜单结束 -->

    <!-- 左侧菜单开始 -->
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">
                        <i class="layui-icon layui-icon-form"></i>
                        &nbsp;菜品管理
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="layui-this"><a id="menu_manage" href="menus.html" target="iframeView">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;查询菜品</a></dd>
                        <dd><a id="order_handler" href="order_handler.html" target="iframeView">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单处理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-user"></i>
                        &nbsp;用户管理
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a id="user_manage" href="users.html" target="iframeView">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;查询用户</a></dd>
                        <dd><a id="user_add" href="user_add.html" target="iframeView">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;添加用户</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 左侧菜单结束 -->

    <!-- 主体开始 -->
    <div class="layui-body">

        <iframe src="menus.html" style="width: 100%;height: 100%;border: 0px" name="iframeView"></iframe>

    </div>
    <!-- 主体结束 -->

    <!-- 底部开始 -->
    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © cjh
    </div>
    <!-- 底部结束 -->
</div>
<script src="layui/layui.all.js" charset="utf-8"></script>
<script>
    //二级菜单联动
    layui.use(['element','jquery'], function(){
        var element = layui.element;
        var $ = layui.jquery;

        $(function () {

            //加载用户昵称
            $.get('/accountApi/getLoginObj/admin',function (res) {
                $('#nickName').text(res.data.username)
            })

            //注销
            $('#logOutBtn').click(function () {
                layer.confirm('真的退出么', function(index){
                    layer.close(index);
                    layer.load(2);
                    $.get("/accountApi/logout",function () {
                        location.href="login.html";
                    })
                });
            })
        })
    });
</script>
</div>
</body>
</html>